/****** Object:  StoredProcedure [dbo].[sp_AgregarInsumo]    Script Date: 18/02/2015 10:49:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[sp_AgregarInsumo](
@Id_Insumo int,
@Estado varchar(50),
@Nombre varchar(50),
@Descripcion varchar(50),
@Stock int,
@StockMaximo int,
@Stockminimo int,
@Id_UnidadMedida int
)
as
insert into Insumo (Id_Insumo,Estado,Nombre,Descripcion,Stock, StockMaximo, Stockminimo, Id_UnidadMedida  )
values(@Id_Insumo,@Estado,@Nombre,@Descripcion,@Stock, @StockMaximo, @Stockminimo, @Id_UnidadMedida  )

GO

/****** Object:  StoredProcedure [dbo].[sp_EliminarInsumo]    Script Date: 18/02/2015 10:49:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[sp_EliminarInsumo]
(@Id_Insumo int)
as
DELETE Insumo where Id_Insumo = @Id_Insumo
GO


/****** Object:  StoredProcedure [dbo].[sp_ModificarInsumo]    Script Date: 18/02/2015 10:49:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[sp_ModificarInsumo](
@Id_Insumo int,
@Estado varchar(50),
@Nombre varchar(50),
@Descripcion varchar(50),
@Stock int,
@StockMaximo int,
@Stockminimo int,
@Id_UnidadMedida int
)
as
update Insumo set  Estado = @Estado,
                   Nombre = @Nombre,
                   Descripcion = @Descripcion,
                   Stock = @Stock, 
                   StockMaximo = @StockMaximo, 
                   Stockminimo = @Stockminimo, 
                   Id_UnidadMedida = @Id_UnidadMedida
where Id_Insumo = @Id_Insumo

GO





/******************** SE CAMBIO COUNT POR MAX
/****** Object:  StoredProcedure [dbo].[sp_ContarProducto]    Script Date: 18/02/2015 10:49:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[sp_ContarProducto]
as
select MAX(Id_Producto) from Producto

GO

****************************************

